import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'


import LoginPage from '@/components/page/Login'
import ErrorPage from '@/components/page/404'

import HomePage from '@/components/common/Home.vue'
import DashBoardPath from '@/components/page/DashBoard.vue'
import GoodsPage from '@/components/page/Goods/Goods.vue'

import StatCenterPage from '@/components/page/StatCenter.vue'
import PluginPage from '@/components/page/Plugin.vue'
import ProfilePage from '@/components/page/Profile.vue'
import AssetPage from '@/components/page/Asset.vue'
import RegisterPage from '@/components/page/Register.vue'

//子控件页面
import profileInfoPage from '@/components/page/subcomponent/profileInfo.vue'
import commonPage from '@/components/page/subcomponent/common.vue'
import managerPage from '@/components/page/subcomponent/manager.vue'
import priterPage from '@/components/page/subcomponent/priter.vue'

//商品管理
import newGoodsPage from '@/components/page/Goods/NewGoods.vue'

//广告管理
//import ADpage from '@/components/page/Ads/index.vue'

//桌位管理
import tableManagePage from '@/components/page/Tables/tableManage.vue'

// 订单管理
import OrderPage from '@/components/page/Order/Order.vue'
import OrderListPage from '@/components/page/Order/list.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect:'/dashboard'
    },
    {
      path:'/login',
      name:'Login',
      component:LoginPage
    },
    {
      path:'/register',
      name:'Register',
      component:RegisterPage
    },
    {
      path:'/',
      name:'HomePage',
      component:HomePage,
      meta:{ title:'主页'},
      children:[
        { path:'/dashboard', component:DashBoardPath,meta:{title:'系统首页' }},
        { path:'/goods',name:'goods',component:GoodsPage,meta:{title:'商品管理' }},
        { path:'/newGoods/:id',name:'newGoods',component:newGoodsPage,meta:{title:'新建商品'}},
        { path:'/order',component:OrderPage,meta:{title:'订单管理' },
          children:[
           { path:'/list',component:OrderListPage,meta:{title:'订单管理'}}
          ],
          redirect:'/list'
        },
        { path:'/statcenter',component:StatCenterPage,meta:{title:'数据中心' }},
        { path:'plugin',component:PluginPage,meta:{title:'应用插件' },
          children:[
            
            ]
        },
        // {
        //   path:'/admanage',component:ADpage,meta:{title:'广告管理'}
        // },
        { path:'tableManage',component:tableManagePage,meta:{title:'桌位管理'}}, //plugin/tableManage
        { path:'/profile',component:ProfilePage,meta:{title:'设置' },
          children:[
            { path:'profileInfo',component:profileInfoPage,meta:{title:'店铺信息'}},
            { path:'common',component:commonPage,meta:{title:'通用设置'}},
            { path:'manager',component:managerPage,meta:{title:'管理员'}},
            { path:'priter',component:priterPage,meta:{title:'打印机'}},
          ],redirect:'/profile/profileInfo'
        },
        { path:'/asset',component:AssetPage,meta:{title:'资产管理' }},
        // { path:'/profileInfo',component:profileInfoPage,meta:{title:'设置'},name:'profileInfo'}

      ]
    },
    {
      path:'*',
      name:'Error',
      component:ErrorPage
    }
  ]
})
